package controller;

import dao.LoginDao;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @version 1.0
 * @Author: 举个栗子吖
 * @Date: 2019-11-16 22:08
 */
@Controller
@RequestMapping("/")
public class LgonController {
    @Resource(name = "loginDao")
    private LoginDao loginDao;

//    @RequestMapping("/login")
////    @ResponseBody
////    public int login(String userCode, String userPassword) {
////        return loginDao.login(userCode, userPassword);
////
////    }

    @RequestMapping("/login")
    public String login(String userName, String pwd) {
        int count = loginDao.login(userName, pwd);
        if (count > 0) {
            return "redirect:/userlist.jsp";
        }
        return "login";
    }
}
